package com.foreveross.mofang.serviceconsole.web.controller.core;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.foreveross.mofang.serviceconsole.core.Channel;
import com.foreveross.mofang.serviceconsole.web.controller.common.BaseController;

@Controller
@RequestMapping("/core/Select")
public class SelectQueryController extends BaseController{
		
	@ResponseBody
	@RequestMapping("/dbType")
	public Map<String, Object> findAll() {
		Map<String, Object> result = new HashMap<String, Object>();
		List<Map<String, String>> list = new ArrayList<Map<String,String>>();
		
		for (Channel.DBType dbType : Channel.DBType.class.getEnumConstants()) {
			Map<String, String> type = new HashMap<String, String>();
			type.put("id", dbType.name());
			type.put("name", dbType.getLable());
			list.add(type);
		}
		
		result.put("dbType", list);
		
		return result;
	}
}
